//
//  CellOfCellOfHot_goods.m
//  FreeTravel
//
//  Created by 徐康 on 16/9/9.
//  Copyright © 2016年 KX. All rights reserved.
//
#import "FreeTravelMacro.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
#import "CellOfCellOfHot_goods.h"
@interface CellOfCellOfHot_goods ()
@property (nonatomic, strong) UIImageView *imageViewOfPhoto;
@property (nonatomic, strong) UILabel *labelOfStatus ;
@property (nonatomic, strong) UILabel *labelOfTitle;
@property (nonatomic, strong) UILabel *labelOfPrice;
@end
@implementation CellOfCellOfHot_goods
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageViewOfPhoto = [[UIImageView alloc]init];
        self.labelOfTitle = [[UILabel alloc]init];
        self.labelOfPrice = [[UILabel alloc]init];
        self.labelOfStatus = [[UILabel alloc]init];
        [self.contentView addSubview:self.imageViewOfPhoto];
        [self.contentView addSubview:self.labelOfStatus];
        [self.contentView addSubview:self.labelOfPrice];
        [self.contentView addSubview:self.labelOfTitle];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViewOfPhoto mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.contentView);
        make.height.mas_offset(130);
    }];
    [self.labelOfTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).mas_offset(10);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-10);
        make.top.equalTo(self.imageViewOfPhoto.mas_bottom).mas_offset(10);
        make.height.mas_offset(30);
        
    }];
    [self.labelOfPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_offset(10);
        make.top.equalTo(self.labelOfTitle.mas_bottom).mas_offset(10);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-10);
        make.left.equalTo(self.contentView.mas_left).mas_offset(10);
    }];
    self.labelOfPrice.font = [UIFont systemFontOfSize:12];
    [self.labelOfStatus mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_offset(10);
        make.top.equalTo(self.labelOfTitle.mas_bottom).mas_offset(10);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-10);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-10);
    }];
    self.labelOfStatus.font = [UIFont systemFontOfSize:12];
}
- (void)setModel:(ModelOfHot_goods *)model{
    _model = model;
    [self.imageViewOfPhoto sd_setImageWithURL:[NSURL URLWithString:model.photo]];
    self.labelOfStatus.text = model.status;
    self.labelOfPrice.text = model.price;
    self.labelOfTitle.text = model.title;
}
@end
